import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter n:");
        int n = scanner.nextInt();
        scanner.nextLine();
        System.out.println("Enter n numbers: ");
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0 ;i<n;i++){
            int a = scanner.nextInt();
            if (!list.contains(a)){
                list.add(a);
            }
        }
        System.out.println("The number of distinct values is "+list.size());
        for (Integer integer : list) {
            System.out.print(integer + " ");
        }
    }
}